package com.niit.qcx.commAgePrice;

import org.apache.hadoop.io.Writable;

import java.io.DataInput;
import java.io.DataOutput;
import java.io.IOException;
public class commAPBean implements Writable {
    private int year;
    private float totalPrice;

    public commAPBean() {

    }

    public commAPBean(int year, float totalPrice) {
        this.year = year;
        this.totalPrice = totalPrice;
    }

    public void set(int year, float totalPrice) {
        this.year = year;
        this.totalPrice = totalPrice;
    }

    public int getYear() {
        return year;
    }

    public void setYear(int year) {
        this.year = year;
    }

    public Float getTotalPrice() {
        return totalPrice;
    }

    public void setTotalPrice(float totalPrice) {

        this.totalPrice = totalPrice;
    }

    @Override
    public void write(DataOutput out) throws IOException {
        out.writeInt(year);
        out.writeFloat(totalPrice);
    }

    @Override
    public void readFields(DataInput in) throws IOException {
        this.year = in.readInt();
        this.totalPrice = in.readFloat();
    }

    @Override
    public String toString() {
        return "  " + year + "年" + "   " + totalPrice + "万元";
    }


}
